package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.GreTreeFamousRecordDao;
import cn.topevery.garden.entity.po.GreTreeFamous;
import cn.topevery.garden.entity.po.GreTreeFamousRecord;
import cn.topevery.garden.entity.query.GreTreeFamousRecordQuery;
import cn.topevery.garden.entity.vo.GreTreeFamousRecordVO;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 古树名木记录表
 *
 * @author code-generate
 * @date 2022-01-05
 */
@Service
public class GreTreeFamousRecordLogic extends BaseLogic<GreTreeFamousRecord> {
    @Autowired
    GreTreeFamousRecordDao greTreeFamousRecordDao;

    @Override
    public BaseEntityDao<GreTreeFamousRecord, Integer> getDao() {
        return greTreeFamousRecordDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<GreTreeFamousRecordVO> listPage(GreTreeFamousRecordQuery query) {
        return greTreeFamousRecordDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        greTreeFamousRecordDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param greTreeFamousRecord 实体
     */
    public void saveOrUpdate(String userId, GreTreeFamousRecord greTreeFamousRecord){
        greTreeFamousRecordDao.saveOrUpdate(userId,greTreeFamousRecord);
    }

    /**
         * 根据自定义列值来获取对象
         */
    public GreTreeFamousRecord getEntityByColumn(String key, String value) {
        return greTreeFamousRecordDao.getEntityByColumn(key, value);
    }

    public int insert(GreTreeFamous greTreeFamous, Integer userId) {
        return greTreeFamousRecordDao.insert(greTreeFamous, userId);
    }
}
